<!DOCTYPE html>
<script src=../../resources/testharness.js></script>
<script src=../../resources/testharnessreport.js></script>
<script>
// Check some video MIME types that should be recordable and a few that should
// not be. Supported MIME types return true. Same for Audio.
// https://w3c.github.io/mediacapture-record/MediaRecorder.html#methods

test(function() {
  assert_false(MediaRecorder.isTypeSupported("video/invalid"));
  assert_false(MediaRecorder.isTypeSupported("video/mpeg4"));
  assert_false(MediaRecorder.isTypeSupported("video/webm;codecs=daala"));
}, 'check MediaRecorder.isTypeSupported() with invalid video MIME types');

test(function() {
  assert_true(MediaRecorder.isTypeSupported("video/webm"));
  assert_true(MediaRecorder.isTypeSupported("video/webm;codecs=vp8"));
  assert_true(MediaRecorder.isTypeSupported("video/webm;codecs=vp9"));
  assert_true(MediaRecorder.isTypeSupported("video/webm;codecs=vp8.0"));
  assert_true(MediaRecorder.isTypeSupported("video/webm;codecs=vp9.0"));
  // "video/webm" supports audio codec specification, see
  // http://www.webmproject.org/docs/container/
  assert_true(MediaRecorder.isTypeSupported("video/webm;codecs=vp8,opus"));
  assert_true(MediaRecorder.isTypeSupported("video/webm;codecs=vp8,pcm"));
  assert_true(MediaRecorder.isTypeSupported("video/WEBM;codecs=VP8,OPUS"));
  assert_true(MediaRecorder.isTypeSupported("video/webm;codecs=vp9,opus"));
  assert_true(MediaRecorder.isTypeSupported("video/webm;codecs=vp8,vp9,opus"));
}, 'check MediaRecorder.isTypeSupported() with valid video MIME types');

test(function() {
  assert_false(MediaRecorder.isTypeSupported("audio/invalid"));
  assert_false(MediaRecorder.isTypeSupported("audio/ogg"));
  assert_false(MediaRecorder.isTypeSupported("audio/webm;codecs=vorbis"));
}, 'check MediaRecorder.isTypeSupported() with invalid audio MIME types');

test(function() {
  assert_true(MediaRecorder.isTypeSupported("audio/webm"));
  assert_true(MediaRecorder.isTypeSupported("audio/webm;codecs=opus"));
  assert_true(MediaRecorder.isTypeSupported("audio/webm;codecs=pcm"));
}, 'check MediaRecorder.isTypeSupported() with valid audio MIME types');

</script>
